home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FileHelpers.h
-
- Contains: Functions to help you when working with files.
-
- Written by: Andy Bachorski
-
- Copyright: Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/21/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- #if PRAGMA_ONCE
- #pragma once
- #endif
-
- #ifndef _FILE_HELPERS_
- #define _FILE_HELPERS_
-
-
- //******************************************************************************
- // A private conditionals file to setup the build environment for this project.
-
- #include "PrivateConditionals.h"
-
-
- //********** Universal Headers ****************************************
-
- #include <AppleEvents.h>
- #include <Files.h>
-
-
- //******************************************************************************
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT
- #pragma import on
- #endif
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=mac68k
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(push, 2)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack(2)
- #endif
-
- //******************************************************************************
-
-
-
- OSErr OpenResFileForWrite( const FSSpec *fileFSSPtr, SInt16 *iconResFileRef );
- /*
-
- Given an FSSpec to a file, open it with write permission.
- Check to make sure that the file reference returned actually has write
- permission and return an error if it doesn't.
-
- fileFSSPtr input: The file to be opened.
- SInt16 output: File reference for the newly opened file.
-
- RESULT CODES
- ____________
- Same as results for FSpOpenResFile()
- ____________
- */
-
- //******************************************************************************
-
- Boolean IsResourceFileRefNumWritable( SInt16 refNum );
- /*
- Utility routine to check that a file opened with read/write permission
- does in fact have read/write permission.
-
- It is possible to get a read-only file reference for a resource file that has
- been opened with read/write permission. This routine verify that a file open
- with read/write permission does in fact have write permission.
-
- refNum input: File reference number for file to be checked.
-
- RESULT CODES
- ____________
- true The resource file was really opened with write permission
- false It wasn't
- ____________
- */
-
-
- //******************************************************************************
-
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(pop)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack()
- #endif
-
- #ifdef PRAGMA_IMPORT_OFF
- #pragma import off
- #elif PRAGMA_IMPORT
- #pragma import reset
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif // _FILE_HELPERS_
-